home *** CD-ROM | disk | FTP | other *** search
- *******************************************************************************
- * PROGRAM: WinApi.prg
- *
- * WRITTEN BY: Borland Late Night Crew
- *
- * DATE: 6/28/93
- *
- * UPDATED: 7/19/93
- *
- * VERSION: Alpha α
- *
- * DESCRIPTION: This program shows how to access useful Windows API functions
- * using Bladerunner's API interface.
- * A window is displayed with a pushbuttons containing different
- * information that can be accessed with the Windows API through
- * Bladerunner. Pressing a pushbutton executes the selected
- * function (or series of functions). The CANCEL pushbutton
- * closes the window.
- *
- * PARAMETERS: None
- *
- * CALLS:
- * GetVersion()
- * GetWinFlags()
- * GetModuleUsage()
- * GetModuleHandle()
- * GetVersion()
- * ShowWindow()
- * GetFreeSpace()
- * SystemParametersInfo()
- * MessageBox()
- * GetWindowsDirectory()
- * GetWindowText()
- * CloseWindow()
- * OpenIcon()
- * GetWindowsDirectory()
- *
- * USAGE: DO Winapi
- *
- *
- *
- *******************************************************************************
- set talk off
- set procedure to sampproc
-
- public show
- show = "System Information"
-
- define window Api from 5,25 to 17,59 of application;
- title "Bladerunner Windows API";
- sizeable
- * pushbuttons referring to different functions/groups of functions to execute
- define pushbutton sysinfo of Api at 1,1 prompt "System Information"
- define pushbutton okcanbox of Api at 3,1 prompt " Message Box "
- define pushbutton winwall of Api at 5,1 prompt " Wallpaper "
- define pushbutton getwintx of Api at 7,1 prompt " Window Captions "
- define pushbutton windir of Api at 9,1 prompt "Windows Directory "
- define pushbutton cancel of Api prompt "CANCEL" at 5,25
- on selection window Api do OnSelApi
- open window Api
- set focus to Api
-
- return
-
- *************************** End of WinApi.prg *********************************
-
-
- *** Procedures and Functions called by OpenWind.prg ***
-
-
- *******************************************************************************
- procedure ShowInfo
-
- * Brings up the Info window. This window contains text objects that correspond
- * to whatever information was selected for viewing in the previous, SelectInfo
- * window, and an image containing the map of Europe highlighting the currently
- * selected country. "Cancel" in this window closes it.
- *******************************************************************************
- private cnt,countryName,background,newArea
- windCnt = windCnt + 1
- cnt = ltrim(str(windCnt))
- countryName = rtrim(country->name)+cnt && in case the same country is chosen
- && more than once
- background = iif(mod(windCnt,2)=0,"b","bg") && alternate background window color
- newArea = ltrim(str(select()))
- if newArea <> "0"
- use country in select() again alias &countryName
- select &countryName
- * don't let the windows go off the screen
- define window Info&cnt from 2+mod(windCnt*2,20),30 + mod(windCnt,10);
- to 13+mod(windCnt*2,20),70+mod(windCnt,10) ;
- of application;
- title "Info -- " + country->name;
- sizeable;
- color w+/&background
- * show the population field for the current country
- define text popText of Info&cnt at 2,3 prompt "Population:"
- define text popInfo of Info&cnt at 3,5 prompt country->population;
- picture "999,999,999,999" function "T" color rb/&background
- * show the capital field for the current country
- define text capText of Info&cnt at 5,3 prompt "Capital:"
- define text capInfo of Info&cnt at 6,5 prompt upper(country->capital);
- color rb/&background
- * show the map of the current country highlighted on a map of Europe
- define text mapText of Info&cnt at 1,25 prompt country->name;
- color gr+/&background
- define image map of Info&cnt from 2,20 to 12,38 memo country->map
- define pushbutton cancel of Info&cnt at 8,5 prompt "CANCEL" default
- on selection window Info&cnt close window Info&cnt
-
- * OPEN this window, and set focus to it. This command causes Info to be
- * added to the list of the currently open windows, but doesn't stop program
- * control flow at the OPEN line. This window is not modal.
- open window Info&cnt
- set focus to Info&cnt
- else && no more available areas
- * Cheap warning
- ?"No more available workareas"
- endif
-
- return
-
-
- *******************************************************************************
- function Open_Clean
-
- * This function closes the Country database, and releases all public variables.
- *******************************************************************************
- close all
- select &savearea
- release savearea
- return .t.
-
-